package com.gdevelop.examples.demo.client;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

import java.util.Date;

public class User {
  private transient PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);

  private String userId;
  private String fullName;
  private Date dob;
  private String email;
  private int numberOfWrongPassword;
  private String password;
  private Boolean enabled;
  
  public User() {
  }
  public User(String userId, String fullName, Date dob, String email, int numberOfWrongPassword, Boolean enabled) {
    this.userId = userId;
    this.fullName = fullName;
    this.dob = dob;
    this.email = email;
    this.numberOfWrongPassword = numberOfWrongPassword;
    this.enabled = enabled;
  }
  
  /*
   * Property Change Support
   */
  public void addPropertyChangeListener(PropertyChangeListener listener){
    changeSupport.addPropertyChangeListener(listener);
  }
  public void addPropertyChangeListener(String propName, PropertyChangeListener listener){
    changeSupport.addPropertyChangeListener(propName, listener);
  }
  public void removePropertyChangeListener(PropertyChangeListener listener){
    changeSupport.removePropertyChangeListener(listener);
  }
  public void removePropertyChangeListener(String propName, PropertyChangeListener listener){
    changeSupport.removePropertyChangeListener(propName, listener);
  }

  public String getUserId(){
    return userId;
  }
  public void setUserId(String userId){
    String oldUserId = this.userId;
    this.userId = userId;
    changeSupport.firePropertyChange("userId", oldUserId, userId);
  }

  public String getFullName() {
    return fullName;
  }
  public void setFullName(String fullName) {
    String oldFullName = this.fullName;
    this.fullName = fullName;
    changeSupport.firePropertyChange("fullName", oldFullName, fullName);
  }

  public String getEmail(){
    return email;
  }
  public void setEmail(String email){
    String oldEmail = this.email;
    this.email = email;
    changeSupport.firePropertyChange("email", oldEmail, email);
  }

  public Date getDob() {
    return dob;
  }
  public void setDob(Date dob) {
    Date oldDob = this.dob;
    this.dob = dob;
    changeSupport.firePropertyChange("dob", oldDob, dob);
  }

  public int getNumberOfWrongPassword() {
    return numberOfWrongPassword;
  }
  public void setNumberOfWrongPassword(int numberOfWrongPassword) {
    int oldNumberOfWrongPassword = this.numberOfWrongPassword;
    this.numberOfWrongPassword = numberOfWrongPassword;
    changeSupport.firePropertyChange("numberOfWrongPassword", oldNumberOfWrongPassword, numberOfWrongPassword);
  }

  public String getPassword() {
    return password;
  }
  public void setPassword(String password) {
    String oldPassword = this.password;
    this.password = password;
    changeSupport.firePropertyChange("password", oldPassword, password);
  }

  public Boolean getEnabled() {
    return enabled;
  }
  public void setEnabled(Boolean enabled) {
    Boolean oldEnabled = this.enabled;
    this.enabled = enabled;
    changeSupport.firePropertyChange("enabled", oldEnabled, enabled);
  }

}
